﻿using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore;

namespace CustomAuthorization.Models
{
    public class User:IdentityUser
    {
        public DateTime Birthday { get; set; }
        public string? NickName { get; set; }
        public long JwtVersion { get; set; }
    }
    public class UserConfig : IEntityTypeConfiguration<User>
    {
        public void Configure(EntityTypeBuilder<User> builder)
        {
            builder.ToTable("T_User");
            //builder.Property(x => x.Birthday).HasDefaultValue(DateTime.Now);
            builder.Property(x => x.NickName).HasMaxLength(50);
            builder.Property(x => x.NormalizedUserName).HasMaxLength(50);
            builder.Property(x => x.Email).HasMaxLength(50);
            builder.Property(x => x.NormalizedEmail).HasMaxLength(50);
            builder.Property(x => x.PhoneNumber).HasMaxLength(50);
        }
    }
}
